/// @description Insert description here
// You can write your code in this editor

flash = max(0, flash - 0.05);
fric = 0.05;
if(z == 0) fric = 0.10;

//弹
if(bounceCount != 0)
{
	bounce += (pi * bounceSpeed);
	if(bounce > pi)
	{
		bounce -= pi;
		bounceHeight *= 0.6;
		bounceCount--;
	}
	z =  sin(bounce) * bounceHeight;
}//bounceCount
else z = 0;
//吸引物品

if(instance_exists(oPlayer))
{
	var _px = oPlayer.x;
	var _py = oPlayer.y;
	var _dis = point_distance(x, y, _px, _py);
	
	if(_dis < 16)
	{
		spd += 0.25;
		direction = point_direction(x, y, _px, _py);
		spd = min(spd, 3);
		
		if(_dis < 5)//收集
		{
			if(collectScriptArgs != -1)
			{
				script_execute(collectScript,collectScriptArgs);	
			}
			else if(collectScript != -1)
			{
				script_execute(collectScript);	
			}
			instance_destroy();
		}
		
	}
}




x += lengthdir_x(spd, direction);
y += lengthdir_y(spd, direction);

spd = max(spd - fric, 0);
depth = -bbox_bottom;
